package com.xintoucloud.pbs.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.xintoucloud.pbs.dao.DevelopMemberDao;
import com.xintoucloud.pbs.entity.DevelopMember;
@Repository@Transactional
public class DevelopMemberDaoImpl implements DevelopMemberDao{
    @Autowired
	private SessionFactory sessionFactory;
	@Override
	public Serializable save(DevelopMember dmi) {
		return sessionFactory.getCurrentSession().save(dmi);
	}

	@Override
	public void delete(Integer bid) {
		sessionFactory.getCurrentSession().delete(getOne(bid));
	}

	@Override@Transactional(readOnly=true)
	public DevelopMember getOne(Integer bid) {
		return sessionFactory.getCurrentSession().get(DevelopMember.class, bid);
	}

	@SuppressWarnings("unchecked")
	@Override@Transactional(readOnly=true)
	public List<DevelopMember> list(Integer oid) {
		return sessionFactory.getCurrentSession().createQuery("from DevelopMember where org.oid=?0")
				.setParameter(0, oid)
				.getResultList();
	}


}
